/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entities1;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author takamflore
 */
@Entity
@Table(catalog = "meteoCalDB", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WeatherInformation.findAll", query = "SELECT w FROM WeatherInformation w"),
    @NamedQuery(name = "WeatherInformation.findById", query = "SELECT w FROM WeatherInformation w WHERE w.id = :id"),
    @NamedQuery(name = "WeatherInformation.findByWeather", query = "SELECT w FROM WeatherInformation w WHERE w.weather = :weather"),
    @NamedQuery(name = "WeatherInformation.findByTemperature", query = "SELECT w FROM WeatherInformation w WHERE w.temperature = :temperature"),
    @NamedQuery(name = "WeatherInformation.findByPrecipitation", query = "SELECT w FROM WeatherInformation w WHERE w.precipitation = :precipitation"),
    @NamedQuery(name = "WeatherInformation.findByCity", query = "SELECT w FROM WeatherInformation w WHERE w.city = :city")})
public class WeatherInformation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(nullable = false, length = 45)
    private String weather;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(nullable = false, length = 45)
    private String temperature;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(nullable = false, length = 45)
    private String precipitation;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(nullable = false, length = 45)
    private String city;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "weather")
    private Collection<Event> eventCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "weather")
    private Collection<Notification> notificationCollection;

    public WeatherInformation() {
    }

    public WeatherInformation(Integer id) {
        this.id = id;
    }

    public WeatherInformation(Integer id, String weather, String temperature, String precipitation, String city) {
        this.id = id;
        this.weather = weather;
        this.temperature = temperature;
        this.precipitation = precipitation;
        this.city = city;
    }
// new weather
    public WeatherInformation(String weather, String temperature, String precipitation, String city) {
        this.weather = weather;
        this.temperature = temperature;
        this.precipitation = precipitation;
        this.city = city;
    }
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getWeather() {
        return weather;
    }

    public void setWeather(String weather) {
        this.weather = weather;
    }

    public String getTemperature() {
        return temperature;
    }

    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }

    public String getPrecipitation() {
        return precipitation;
    }

    public void setPrecipitation(String precipitation) {
        this.precipitation = precipitation;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @XmlTransient
    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @XmlTransient
    public Collection<Notification> getNotificationCollection() {
        return notificationCollection;
    }

    public void setNotificationCollection(Collection<Notification> notificationCollection) {
        this.notificationCollection = notificationCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WeatherInformation)) {
            return false;
        }
        WeatherInformation other = (WeatherInformation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.WeatherInformation[ id=" + id + " ]";
    }
    
}
